package com.huilian.iotbox.admin.service.impl;

import com.huilian.iotbox.admin.dao.DeliveryAddressDao;
import com.huilian.iotbox.admin.service.DeliveryAddressService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.po.DeliveryAddress;
import com.huilian.iotbox.data.vo.DeliveryAddressVo;
import com.huilian.iotbox.data.vo.UserInfo;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;

/**
 * @author 谢洛涛
 * @date 2021/9/7 9:28
 */
@Service
public class DeliveryAddressServiceImpl implements DeliveryAddressService {
    @Resource
    private DeliveryAddressDao deliveryAddressDao;




    @Override
    public ServerResponse delete(Integer userId, Integer deliveryAddressId) {
        if(deliveryAddressDao.delete(userId,deliveryAddressId)>0){
            return ServerResponse.createBySuccess("收货地址删除成功");
        }else{
            return ServerResponse.createByErrorMessage("收货地址删除失败");
        }
    }

    @Override
    public DeliveryAddressVo findDeliveryAddress(Integer deliveryAddressId) {
        return deliveryAddressDao.findDeliveryAddress(deliveryAddressId);
    }
}
